/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Model;

import Componenten.Coordinaat;
import Componenten.LocalTypes;
import java.awt.Image;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import javax.swing.ImageIcon;

/**
 *
 * @author Bram Slob en Roderick van Seijen
 */
public class Vak implements LocalTypes {
    
    private VakType vakType;
    private Coordinaat pos;
    private Element element;
    private Map<Richting, Vak> buren;
    private Image afbeelding;
    
    public Vak(Coordinaat p){
        buren = new HashMap();
        pos = p;
    }
    
    public Image getAfbeelding(){
        return afbeelding;
    }
    
    public VakType getVakType()
    {
        return vakType;
    }
    
    public void setVakType(VakType vt)
    {
        vakType = vt;
        
        URL loc = null;
        
        switch(vt){
            case NORMAAL:
                loc = this.getClass().getResource("/Resources/grass2.jpg"); 
            break;
            case EINDVAK:
                loc = this.getClass().getResource("/Resources/EndField.jpg");
            break;
        }
        
        ImageIcon iia = new ImageIcon(loc);
        afbeelding = iia.getImage();
    }
    
    public Coordinaat getPositie () {
        return pos;
    }
    
    public void setPositie(int x, int y) {
        pos.setX(x);
        pos.setY(y);
    }
    
    public Element getElement(){
        return element;
    }
    
    public void setElement(Element e){
        element = e;
    }
    
    public Vak getBuurvak(Richting r){
        return buren.get(r);
    }
    
    public void setBuurvak(Richting r, Vak v){
        buren.put(r, v);
    }
    
}